home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6068 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: accessing structures (newbie question)
  5. Date: 22 Feb 96 12:42:23 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.824992943@rscernix>
  8. References: <4g8gic$o6u@news1.sunbelt.net> <3128FA60.5227@metagen.co.uk> <TANMOY.96Feb19090845@qcd.lanl.gov> <4geju0$sif@maureen.teleport.com>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <4geju0$sif@maureen.teleport.com> hksys@teleport.com (GHouck) writes:
  13.  
  14. >tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) wrote:
  15. >[snip]
  16. >>What nonsense! Anything creates trouble if you do not take the time
  17. >>to understand it.
  18. >>
  19. >>   I think you may have been using the wrong syntax when you tried the array 
  20. >>   method. The xth item is given by 'photos[x].' which is equivalent to 
  21. >>   '(photos + x * sizeof(picture))->'.
  22. >>
  23. >>This is the problem!!! photos[x]. is always the same as (photos + x)->
  24. >>In fact, this is such a basic fact of pointer arithmetic that anyone
  25. >>who posts such nonsense must surely be trying to deliberately mislead
  26. >>newbies. We have enough confusion here: please refrain from posting
  27. >>_answers_ unless you know at least the basics of C! 
  28. >>
  29. >Tanmoy,
  30. >
  31. >Speaking of nonsense (your word), what is the meaning of your statement:
  32. >
  33. >>   '(photos + x * sizeof(picture))->'.  ?
  34. >
  35. >It may make sense conceptually, but syntactically you will step thru
  36. >the array of structures rather quickly (by a factor of sizeof(picture)).
  37. >Unless I'm mistaken, did you not mean:
  38. >>    '(photos+x)->' ?
  39. >To use your cordial words:  'We have enough confusion here: please refrain
  40. >from posting _answers_ unless you know at least the basics of C!'
  41.  
  42. This is what Tanmoy gets for using a non-standard quoting technique :-)
  43.  
  44. If GHouck would have invested a few neurons in the job, he would have
  45. realized that '(photos + x * sizeof(picture))->' was written by
  46. someone else and criticised by Tanmoy.  This is _obvious_ if you read
  47. the text actually written by Tanmoy.
  48.  
  49. Dan
  50. --
  51. Dan Pop
  52. CERN, CN Division
  53. Email: danpop@mail.cern.ch 
  54. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  55.